package com.ruoyi.project.query.paeaDsInvt.controller;

import java.util.ArrayList;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.project.query.paeaDsLink.domain.DsAccInvm;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.query.paeaDsInvt.domain.PaeaDsInvt;
import com.ruoyi.project.query.paeaDsInvt.service.IPaeaDsInvtService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import java.util.Arrays;

import com.ruoyi.framework.web.page.TableDataInfo;

/**
 * 定一本主子账户关系历史Controller
 *
 * @author gang.wei
 * @date 2020-04-06
 */
@Controller
@RequestMapping("/query/paeaDsInvt")
public class PaeaDsInvtController extends BaseController
{
    private String prefix = "query/paeaDsInvt";

    @Autowired
    private IPaeaDsInvtService paeaDsInvtService;

    @RequiresPermissions("query:paeaDsInvt:view")
    @GetMapping()
    public String paeaDsInvt()
    {
        return prefix + "/paeaDsInvt";
    }

    /**
     * 查询定一本主子账户关系历史列表
     */
    @RequiresPermissions("query:paeaDsInvt:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(PaeaDsInvt paeaDsInvt)
    {
        return getDataTable(new ArrayList<DsAccInvm>());
    }
    /**
     * 查询定一本主子账户关系历史列表
     */
    @RequiresPermissions("query:paeaDsInvt:queryAccInvm")
    @PostMapping("/queryAccInvm")
    @ResponseBody
    public TableDataInfo queryAccInvm(PaeaDsInvt paeaDsInvt)
    {
        startPage();
        List<DsAccInvm> list = paeaDsInvtService.queryAccInvm(paeaDsInvt);
        return getDataTable(list);
    }
    /**
     * 导出定一本主子账户关系历史列表
     */
    @RequiresPermissions("query:paeaDsInvt:export")
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(PaeaDsInvt paeaDsInvt)
    {
        List<PaeaDsInvt> list = paeaDsInvtService.list(new QueryWrapper<>(paeaDsInvt));
        ExcelUtil<PaeaDsInvt> util = new ExcelUtil<PaeaDsInvt>(PaeaDsInvt.class);
        return util.exportExcel(list, "paeaDsInvt");
    }

    /**
     * 新增定一本主子账户关系历史
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存定一本主子账户关系历史
     */
    @RequiresPermissions("query:paeaDsInvt:add")
    @Log(title = "定一本主子账户关系历史", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(PaeaDsInvt paeaDsInvt)
    {
        return toAjax(paeaDsInvtService.saveOrUpdate(paeaDsInvt));
    }

    /**
     * 修改保存定一本主子账户关系历史
     */
    @RequiresPermissions("query:paeaDsInvt:edit")
    @Log(title = "定一本主子账户关系历史", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(PaeaDsInvt paeaDsInvt)
    {
        return toAjax(paeaDsInvtService.saveOrUpdate(paeaDsInvt));
    }

    /**
     * 删除定一本主子账户关系历史
     */
    @RequiresPermissions("query:paeaDsInvt:remove")
    @Log(title = "定一本主子账户关系历史", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(paeaDsInvtService.removeByIds(Arrays.asList(ids.split(","))));
    }
}
